﻿// See https://aka.ms/new-console-template for more information
using System;

class Program
{
    static void Main()
    {
        int[] numbers = { 5, 7, 2, 10, 3, -1, 14, 0 };
 
        int max = GetMax(numbers);
        int min = GetMin(numbers);
        double average = GetAverage(numbers);
        int sum = GetSum(numbers);

        Console.WriteLine($"最大值: {max}");
        Console.WriteLine($"最小值: {min}");
        Console.WriteLine($"平均值: {average}");
        Console.WriteLine($"总和: {sum}");
    }

    static int GetMax(int[] arr)
    {
        int max = arr[0];
        foreach (int num in arr)
        {
            if (num > max)
            {
                max = num;
            }
        }
        return max;
    }

    static int GetMin(int[] arr)
    {
        int min = arr[0];
        foreach (int num in arr)
        {
            if (num < min)
            {
                min = num;
            }
        }
        return min;
    }

    static double GetAverage(int[] arr)
    {
        int sum = GetSum(arr);
        return (double)sum / arr.Length;
    }

    static int GetSum(int[] arr)
    {
        int sum = 0;
        foreach (int num in arr)
        {
            sum += num;
        }
        return sum;
    }
}